cmake_minimum_required(VERSION 3.5.1)
project(watchdog_python)

##############################################################################

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR aarch64)
SET(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
SET(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
SET(CMAKE_C_STANDARD 99)
SET(CMAKE_CXX_STANDARD 14)

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(CMAKE_BUILD_TYPE "RELEASE")

##############################################################################

find_package(OpenCV REQUIRED)

find_package(pybind11 CONFIG REQUIRED)

include_directories(/usr/local/include/)
include_directories(/usr/include/python3.10)
include_directories(${OpenCV_INCLUDE_DIRS})

link_directories(/usr/lib/aarch64-linux-gnu/)

aux_source_directory(model MODEL_SRC)

#############################################################

add_library(locke_interface MODULE ${MODEL_SRC})

target_link_directories(locke_interface 
    PRIVATE
    pybind11::module
    ${OpenCV_LIBS}
    
)

pybind11_extension(locke_interface)
if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
    # Strip unnecessary sections of the binary on Linux/macOS
    pybind11_strip(locke_interface)
endif()

set_target_properties(
    PROPERTIES
    PREFIX "${PYTHON_MODULE_PREFIX}"
    SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
